export const CHINA_PAYMENT_CONFIG = {
  // 基础配置
  basic: {
    // 存储路径
    paths: {
      cert: 'D:\\cert\\payment',
      logs: 'D:\\logs\\payment',
      temp: 'D:\\temp\\payment',
    },

    // 货币设置
    currency: {
      type: 'CNY',
      symbol: '¥',
      precision: 2,
    },
  },

  // 支付渠道配置
  channels: {
    // 支付宝配置
    alipay: {
      enabled: true,
      sandbox: process.env.NODE_ENV !== 'production',
      appId: process.env.ALIPAY_APP_ID,
      privateKey: process.env.ALIPAY_PRIVATE_KEY,
      publicKey: process.env.ALIPAY_PUBLIC_KEY,
      notifyUrl: 'https://api.example.com/payment/alipay/notify',
      returnUrl: 'https://example.com/payment/result',

      // 产品配置
      products: {
        recharge: {
          subject: '账户充值',
          body: '直播平台虚拟币充值',
        },
        vip: {
          subject: 'VIP购买',
          body: '直播平台会员购买',
        },
      },
    },

    // 微信支付配置
    wechat: {
      enabled: true,
      sandbox: process.env.NODE_ENV !== 'production',
      appId: process.env.WXPAY_APP_ID,
      mchId: process.env.WXPAY_MCH_ID,
      apiKey: process.env.WXPAY_API_KEY,
      certPath: 'D:\\cert\\payment\\wechat\\apiclient_cert.p12',
      notifyUrl: 'https://api.example.com/payment/wechat/notify',

      // 产品配置
      products: {
        recharge: {
          body: '直播平台充值',
          attach: 'recharge',
        },
        vip: {
          body: 'VIP会员',
          attach: 'vip',
        },
      },
    },
  },

  // 风控配置
  riskControl: {
    enabled: true,
    rules: {
      // 单笔限额
      singleLimit: {
        min: 0.01,
        max: 50000,
      },
      // 每日限额
      dailyLimit: {
        recharge: 50000,
        gift: 10000,
      },
      // 异常检测
      detection: {
        enabled: true,
        rules: [
          {
            type: 'frequency',
            threshold: 20,
            timeWindow: 3600,
          },
          {
            type: 'amount',
            threshold: 10000,
            timeWindow: 86400,
          },
        ],
      },
    },
  },

  // 监控配置
  monitor: {
    enabled: true,
    metrics: ['支付成功率', '支付响应时间', '退款率', '异常交易数'],
    alert: {
      enabled: true,
      channels: ['wecom', 'sms'],
      rules: {
        successRate: {
          threshold: 95,
          interval: '5m',
        },
        responseTime: {
          threshold: 3000,
          interval: '1m',
        },
      },
    },
  },

  // 对账配置
  reconciliation: {
    enabled: true,
    schedule: '0 2 * * *', // 每天凌晨2点
    savePath: 'D:\\data\\payment\\reconciliation',
    notification: {
      email: ['finance@example.com'],
      wecom: ['财务组'],
    },
  },

  // 日志配置
  logging: {
    enabled: true,
    level: 'info',
    path: 'D:\\logs\\payment',
    retention: 90, // 保留90天
    sensitive: ['bankCard', 'idCard', 'phone'],
  },
}
